home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware Gold / Windows Shareware Gold Volume 3 Number 1 (Sherburne Knowledge Systems) (1991).iso / apps / f1179 / cmdpost.cp$ < prev    next >
Text File  |  1991-10-02  |  43KB  |  1,179 lines

  1. ; Define addon menu   USER menus should go into CMDUSER.CPM...by convention...
  2. #NextFile CMDUSER.CPM
  3.  
  4.  
  5. ; CmdPost menu    initialization code
  6.  
  7.         ; Initialize a few variables here. 
  8.       
  9.         a=Version()
  10.         CP="CmdPost"
  11.         CPDIR=DirHome()
  12.         crlf=strcat(num2char(13),num2char(10))
  13.         cpini="WWW-PROD.INI"
  14.         tab=num2char(9)
  15.         Editor=inireadpvt(CP,"Editor","Notepad.exe",cpini)
  16.         CopyMoveDefault=""
  17.         
  18.  
  19. ; Setting up the View menu item here.
  20.         a=inireadpvt(CP,"ViewSetup","NO",cpini)
  21.         if a=="NO" then goto DEFSETUP
  22.  
  23.         ViewShortLong=inireadpvt(CP,"ViewShortLong","SHORT",cpini)
  24.  
  25.         if ViewShortLong=="SHORT" then MenuChange("ViewShort",@CHECK)
  26.         if ViewShortLong=="LONG" then MenuChange("ViewLong",@CHECK)
  27.         
  28.         ViewBy=inireadpvt(CP,"ViewBy","NAME",cpini)
  29.         if ViewBy=="NAME" then MenuChange("ViewByName",@CHECK)
  30.         if ViewBy=="DATE" then MenuChange("ViewByDate",@CHECK)
  31.         if ViewBy=="SIZE" then MenuChange("ViewBySize",@CHECK)
  32.         if ViewBy=="KIND" then MenuChange("ViewByKind",@CHECK)
  33.         if ViewBy=="UNSORTED" then MenuChange("ViewUnsorted",@CHECK)
  34.  
  35.         ViewWhat=inireadpvt(CP,"ViewWhat","ALL",cpini)
  36.         if ViewWhat=="ALL" then MenuChange("ViewAll",@CHECK)
  37.         if ViewWhat=="PARTIAL" then MenuChange("ViewPartial",@CHECK)
  38.         if ViewWhat=="PROGRAMS" then MenuChange("ViewPrograms",@CHECK)
  39.  
  40.         SD3="*.*"
  41.         if ViewWhat=="PROGRAMS" then SD3="*.EXE *.COM *.BAT *.PIF"
  42.         if ViewWhat=="PARTIAL" then SD3=inireadpvt(CP,"Partial","*.*",cpini)
  43.         SetDisplay(ViewShortLong,ViewBy,SD3)
  44.         drop(ViewShortLong,ViewBy,ViewWhat,SD3)
  45.         goto PRINTSETUP
  46.  
  47.         :DEFSETUP
  48.         SetDisplay("SHORT","NAME","*.*")
  49.         MenuChange("ViewAll",@CHECK)
  50.         MenuChange("ViewByName",@CHECK)
  51.         MenuChange("ViewShort",@CHECK)
  52.  
  53. ; Setup Print menu item...Kill it if no text printer
  54.         :PRINTSETUP
  55.         MenuChange("FilePrint", (inireadpvt(CP,"TextPrinter","",cpini)=="NONE") *@DISABLE)
  56.         
  57. ; Setup Screen Blank Time.  Get time from win.ini
  58.         a=inireadpvt(CP,"BlankTime",5,cpini)
  59.         if a!=9999 then run("%CPDIR%cp_blnk.exe",a)
  60. ;                             ;    <0....blanking with no clock
  61. ;                             ;     0... no blanking, but have a clock
  62. ;                             ;    >0... blanking and clock
  63. ;                             ;    9999  Don't even run it.
  64. ;                             ;    multiple startups ignored.
  65.  
  66.  
  67.         if IsRunning() then goto goombye
  68.         a=inireadpvt(CP,"AutoStart","YES",cpini)
  69.         if a!="YES" then goto goombye
  70.  
  71.         ;if Display(3,"Auto Startup","Hit any key to bypass WIN.INI%crlf%Run= and Load= processing") then goto goombye
  72.         
  73.         a=iniread("windows","load","")
  74.         b=ItemCount(a," ")
  75.         d=0
  76.         :woop1
  77.         if d==b then goto dorun
  78.         d=d+1
  79.         c=ItemExtract(d,a," ")
  80.         Runicon(c,"")
  81.         goto woop1
  82.         
  83.         :dorun
  84.         a=iniread("windows","run","")
  85.         b=ItemCount(a," ")
  86.         d=0
  87.         :woop2
  88.         if d==b then goto goombye
  89.         d=d+1
  90.         c=ItemExtract(d,a," ")
  91.         Run(c,"")
  92.         goto woop2
  93.  
  94.         :goombye
  95.         drop(a,b,c,d)
  96.  
  97. ; And the main menu starts.  
  98. &File
  99.  &Run...
  100.         r=CurrentFile()
  101.         if !IsKeyDown(@SHIFT) then r=askline("RUN","Enter file to run",r)
  102.         r=strcat(strtrim(r)," ")
  103.         i=strindex(r," ",0,@FWDSCAN)
  104.         a=strsub(r,1,i-1)
  105.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  106.         run("%a%","%b%")
  107.         drop(a,b,r,i)        
  108.  &Load...
  109.         r=CurrentFile()
  110.         if !IsKeyDown(@SHIFT) then l=askline("LOAD","Enter file to load",CurrentFile())
  111.         l=strcat(strtrim(l)," ")
  112.         i=strindex(l," ",0,@FWDSCAN)
  113.         a=strsub(r,1,i-1)
  114.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  115.         runicon("%a%","%b%")
  116.         drop(a,b,i,l)
  117.  Bro&wse...   \ {F3}
  118.         l=CurrentFile()
  119.         ;if !IsKeyDown(@SHIFT) then l=strtrim(askline("Browse","Enter file to browse",l))
  120.         run("%CPDIR%browser.exe",l)
  121.         drop(a,l)
  122.  &Edit...    \ {F4}
  123.         l=CurrentFile()
  124.         ;if !IsKeyDown(@SHIFT) then l=askline("Edit","Enter file to edit",l)
  125.         if l=="" || l==" " then goto NULL
  126.         a=strscan(l,".\",0,@BACKSCAN)
  127.         if a==0 then l=strcat(l,".")
  128.         if a==0 then goto NULL
  129.         if strsub(l,a,1)!="." then l=strcat(l,".")
  130.      :NULL
  131.         run(Editor,strtrim(l))
  132.         drop(a,b,l)
  133.  &Copy... \ {F8}
  134.         r=OtherDir()
  135.         if r!=DirGet() then goto NEXT
  136.         if CopyMoveDefault!="" then r=CopyMoveDefault
  137.         :NEXT
  138.         s=strcat(DirItemize("")," ",FileItemize(""))
  139.         terminate(strlen(s)==1,"Copy Error","No files selected")
  140.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Copy",StrCat(s,crlf,crlf,"to"),r))
  141.         terminate(r=="","Copy Error","Cannot copy to null file name")        
  142.         q=strindex(r,"\",0,@FWDSCAN) ; Directory Name in there??
  143.         CopyMoveDefault=r
  144.         if q==0 then SetDisplay("","","") ;Nope. Set flag to update directory
  145.         FileCopy(s,r,@TRUE)
  146.         OtherUpdate()
  147.         drop(r,s,q)
  148.  &Move/Rename...  \  {F7}
  149.         r=OtherDir()
  150.         if r!=DirGet() then goto NEXT
  151.         if CopyMoveDefault!="" then r=CopyMoveDefault
  152.         :NEXT
  153.         s=strcat(DirItemize("")," ",FileItemize(""))
  154.         terminate(strlen(s)==1,"Move Error","No files selected")
  155.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Move",StrCat(s,crlf,crlf,"to"),r))
  156.         terminate(r=="","Move Error","Cannot move to null file name")
  157.         SetDisplay("","","") ;Set flag to update directory
  158.         CopyMoveDefault=r
  159.         FileMove(s,r,@TRUE)
  160.         OtherUpdate()
  161.         drop(r,s)
  162.  &Delete File... \ {DEL}
  163.         f=FileItemize("")
  164.         g=DirItemize("")
  165.         b=0
  166.         if strlen(g)!=0 then b=AskYesNo("!!! Warning !!! ",strcat("Delete files from these directories too?",crlf,g))
  167.         if b!=0 then f=strcat(g," ",f)
  168.         terminate(strlen(f)==0,"delete","No files specified")
  169.         if !IsKeyDown(@SHIFT) then if askyesno("Delete",f)==@NO then exit
  170.         SetDisplay("","","") ;Set flag to update directory
  171.         FileDelete(f)
  172.         OtherUpdate()  ; Well if the "other" CmdPost Window points to the
  173.                     ; same directory, it *IS* nice...
  174.         drop(f,g,b)
  175.  
  176.  &Print...
  177.         s=FileItemize("")
  178.         terminate(strlen(s)==0,"Print Error","No files selected")
  179.         TextPrinter=inireadpvt(CP,"TextPrinter","ASK",cpini)
  180.         if TextPrinter!="ASK" then goto NOASK1
  181.         r=AskYesNo("Attention",strcat("This print routine only works with standard printers.",crlf,"Do you have a standard (NON-Postscript) printer?"))
  182.         if r==@YES then goto ASK1
  183.         iniwritepvt(CP,"TextPrinter","NONE",cpini)
  184.         MenuChange("FilePrint",@DISABLE)
  185.         Exit
  186.         :ASK1
  187.         TextPrinter="NONE|LPT1|LPT2|LPT3"
  188.         TextPrinter=ItemSelect("Choose the STD text printer",TextPrinter,"|")
  189.         terminate(strlen(TextPrinter)==0,"Error","Nothing chosen")
  190.         iniwritepvt(CP,"TextPrinter",TextPrinter,cpini)
  191.         :NOASK1
  192.         Terminate(TextPrinter=="NONE","ERROR","No Text Printers on system")
  193.         a=AskLine("Print",strcat(s,crlf,crlf,"to"),TextPrinter)
  194.         FileCopy(s,a,@FALSE)
  195.         
  196.  _File &Info
  197.         a=FileItemize("")
  198.         terminate(a=="","File Stats","No Files Selected")
  199.         tot=FileSize(a)
  200.         c=ItemCount(a," ") 
  201.         n=0
  202.         b=""
  203.         :loop
  204.         if n==c then goto show
  205.         n=n+1
  206.         a1=StrFix(ItemExtract(n,a," ")," ",14)
  207.         a2=FileSize(a1)
  208.         a3=FileTimeGet(a1)
  209.         a4=FileAttrGet(a1)
  210.         b=strcat(b,a1,tab,a2,tab,a3,tab,a4,"|")
  211.         goto loop
  212.         :show
  213.         ItemSelect("Total Size=%tot%",b,"|")
  214.         :cancel
  215.         drop(a,tot,c,n,a1,a2,a3,a4,b)
  216.         
  217.  &Freespace on Drives   
  218.  
  219.         NextDrive="C"    ;ASSUMES C is your first hard drive.
  220.         TotalSize=0
  221.         DriveReport=""
  222.         ErrorMode(@off)
  223.  
  224.         :COUNTSPACE
  225.         ; Start with  do C drive
  226.         a=DiskFree(NextDrive)/1024
  227.         TotalSize=a+TotalSize
  228.         DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
  229.         :TRYNEXT
  230.         NextDrive=num2char(char2num(NextDrive)+1)
  231.         if NextDrive=="Z" then goto DATOTAL
  232.         if LogDisk(NextDrive) then goto COUNTSPACE
  233.         goto TRYNEXT
  234.         
  235.         :DATOTAL
  236.         ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
  237.         Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
  238.                    
  239.  _E&xit Windows \ ^X
  240.         EndSession()
  241.         
  242.  |Find file
  243.   On DOS Path
  244.          a=AskLine("Locate file in path","Enter file name to locate","")
  245.          b=FileLocate(a)
  246.          terminate(b=="",a,"File Not Located")
  247.          if AskYesNo(b,"File Located.%crlf%Change to that directory?")==@NO then exit
  248.          DirChange(FilePath(b))
  249.          SetDisplay("","","")
  250.   On Current Drive
  251.         Mask=Askline("Find File on drive","Enter file name to locate","*.bak")
  252.         FileList=""
  253.         tot=0
  254.         totdir=0
  255.         DirChange("\")
  256.         LocalList=FileItemize(Mask)
  257.         if LocalList=="" then goto skip11
  258.         tot = FileSize(LocalList)
  259.         totdir=1
  260.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  261.         locdir=DirGet()
  262.         LocalList=strreplace(LocalList," "," %locdir%")
  263.         FileList=LocalList
  264.         Drop(LocalList)
  265.         :Skip11
  266.         level=1
  267.         dir1=DirGet()
  268.         sub1 = DirItemize("*.*")
  269.         numdir1 = ItemCount(sub1, " ")
  270.         index1 = 0
  271.   
  272.         :loop
  273.         If index%level% == numdir%level% Then Goto upalevel
  274.         index%level% = index%level% + 1
  275.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  276.         LocDir = DirGet()
  277.         LocalList=FileItemize(Mask)
  278.         if LocalList=="" then goto skip22
  279.         totdir=totdir+1
  280.         tot = tot + FileSize(LocalList)
  281.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  282.         LocalList=strreplace(LocalList," "," %locdir%")
  283.         FileList=Strcat(FileList,LocalList)
  284.         drop(LocalList)
  285.         :skip22
  286.         level = level + 1
  287.         dir%level%=LocDir
  288.         sub%level% = DirItemize("*.*")
  289.         numdir%level% = ItemCount(sub%level%, " ")
  290.         index%level% = 0
  291.         goto loop
  292.   
  293.         :upalevel
  294.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  295.         level=level-1
  296.         if level!=0 then goto loop
  297.  
  298.         :done
  299.         ; -----------
  300.         ; Termination
  301.         ; -----------
  302.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  303.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  304.         tot = StrTrim(tot)
  305.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  306.         tot = StrTrim(tot)
  307.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  308.         tot = StrTrim(tot)
  309.         if FileList!="" then FileList=Strsub(FileList,2,strlen(FileList)-1)
  310.         level=ItemCount(FileList," ")
  311.         SelectedFile=ItemSelect("%totdir% SubDirs.  %level% Files. %tot% bytes.",FileList," ")
  312.         drop(tot,level,totdir,FileList,SelectedFile)
  313.         
  314.  _&Hilite Files
  315.   By Names
  316.         a=AskLine("Hilite Files","Enter types of files to hilite",strcat("*.",FileExtension(CurrentFile())))
  317.         FileHilite(a,@TRUE)
  318.   By Attribute
  319.         :askagain
  320.         a="Enter an attribute to hilite. R A S  or H"
  321.         b="Use CAPS to hilite if attribute is set,"
  322.         c="Use lowercase to hilite if not set."
  323.         a=strcat(a,crlf,b,crlf,c,crlf,"Enter only one character. R A S or H")
  324.         drop(b,c)
  325.         a=AskLine("Hilite by Attribute",a,"A")
  326.         if strlen(a)!=1 then goto askagain
  327.         case=2
  328.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  329.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  330.         a=strupper(a)
  331.         if case==2 then goto askagain
  332.         d=FileItemize("*.*")
  333.         e=ItemCount(d," ")
  334.         f=0
  335.         :loop
  336.         f=f+1
  337.         if f>e then exit
  338.         q=ItemExtract(f,d," ")
  339.         g=FileAttrGet(q)
  340.         h=strscan(g,a,1,@FWDSCAN)
  341.         if h>0 then h=1
  342.         ;display(3,"%a% %h%","%q% %g%:
  343.         if case==h then filehilite(q,@TRUE)
  344.         ;beep 
  345.         goto loop
  346.  &Unhilite Files
  347.   By Name
  348.         a=AskLine("Unhilite Files","Enter types of files to unhilite",strcat("*.",FileExtension(CurrentFile())))
  349.         FileHilite(a,@FALSE)
  350.   By Attribute
  351.         :askagain
  352.         a="Enter an attribute to hilite. R A S  or H"
  353.         b="Use CAPS to hilite if attribute is set,"
  354.         c="Use lowercase to hilite if not set."
  355.         a=strcat(a,crlf,b,crlf,c,crlf,"Enter only one character. R A S or H")
  356.         drop(b,c)
  357.         a=AskLine("Hilite by Attribute",a,"A")
  358.         if strlen(a)!=1 then goto askagain
  359.         case=2
  360.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  361.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  362.         a=strupper(a)
  363.         if case==2 then goto askagain
  364.         d=FileItemize("*.*")
  365.         e=ItemCount(d," ")
  366.         f=0
  367.         :loop
  368.         f=f+1
  369.         if f>e then exit
  370.         q=ItemExtract(f,d," ")
  371.         g=FileAttrGet(q)
  372.         h=strscan(g,a,1,@FWDSCAN)
  373.         if h>0 then h=1
  374.         ;display(3,"%a% %h%","%q% %g%:
  375.         if case==h then filehilite(q,@FALSE)
  376.         ;beep 
  377.         goto loop
  378.  
  379.  _File Attributes
  380.   View/Modify current file
  381.         DaFile=CurrentFile()
  382.         :REDO
  383.         attr=FileAttrGet(DaFile)
  384.         RD=2
  385.         AR=2
  386.         SY=2
  387.         HD=2
  388.         if strsub(attr,1,1)=="R" then  RD=1
  389.         if strsub(attr,2,1)=="A" then  AR=1
  390.         if strsub(attr,3,1)=="S" then  SY=1
  391.         if strsub(attr,4,1)=="H" then  HD=1
  392.         OldHD=HD
  393.         OldSY=SY
  394.         DialogBox("View/Modify Attributes","cp_attr2.dlg")
  395.         If OldHD!=HD then b=AskYesNo("Attribute Changer","Note: Changing Hidden attribute is unusual%crlf%Continue?")
  396.         if b==@NO then goto REDO
  397.         If OldSy!=SY then b=AskYesNo("Attribute Changer","Note: Changing System attribute is unusual%crlf%Continue?")
  398.         if b==@NO then goto REDO
  399.         attr=""
  400.         if RD==1 then attr="R"
  401.         if RD==2 then attr='r'
  402.         if AR==1 then attr=strcat(attr,"A")
  403.         if AR==2 then attr=strcat(attr,"a")
  404.         if HD==1 then attr=strcat(attr,"H")
  405.         if HD==2 then attr=strcat(attr,"h")
  406.         if SY==1 then attr=strcat(attr,"S")
  407.         if SY==2 then attr=strcat(attr,"s")
  408.         FileAttrSet(DaFile,attr)
  409.         SetDisplay("","","")
  410.         
  411.  
  412.   Change hilited files
  413.         a=FileItemize("")
  414.         terminate(a=="","Attribute Changer","No files Hilited")
  415.         string=a
  416.         if strlen(string)<35 then goto REDO
  417.         string=strcat(strfix(string," ",35)," ...")
  418.         :REDO
  419.         RD=3
  420.         AR=3
  421.         SY=3
  422.         HD=3
  423.         DialogBox("Attribute Changer","cp_attr1.dlg")        
  424.         If HD!=3 then b=AskYesNo("Attribute Changer","Note: Selecting Hidden attribute is unusual%crlf%Continue?")
  425.         if b==@NO then goto REDO
  426.         If SY!=3 then b=AskYesNo("Attribute Changer","Note: Selecting System attribute is unusual%crlf%Continue?")
  427.         if b==@NO then goto REDO
  428.         attr=""
  429.         if RD==1 then attr="R"
  430.         if RD==2 then attr='r'
  431.         if AR==1 then attr=strcat(attr,"A")
  432.         if AR==2 then attr=strcat(attr,"a")
  433.         if HD==1 then attr=strcat(attr,"H")
  434.         if HD==2 then attr=strcat(attr,"h")
  435.         if SY==1 then attr=strcat(attr,"S")
  436.         if SY==2 then attr=strcat(attr,"s")
  437.         FileAttrSet(a,attr)
  438.         SetDisplay("","","")
  439.  
  440.  
  441.         
  442.  _Floppy Space
  443.   A:
  444.         message(strcat("Drive A ",DiskFree("A")),strcat("Selected Files ",FileSize(FileItemize(""))))
  445.   B:
  446.         message(strcat("Drive B ",DiskFree("B")),strcat("Selected Files ",FileSize(FileItemize(""))))
  447.  
  448.  
  449.  _&Extensions...
  450.         a=strtrim(CurrentFile())
  451.         i=strindex(a,".",0,@FWDSCAN)
  452.         terminate(i==0,"Association Error","Associated files must have an extension")
  453.         b=FileExtension(a)
  454.         c=iniread("extensions",b,"???.EXE ^.%b%")
  455.         d=askline("Associate","%b% files are associated with",c)
  456.         terminate(c==d,"","")
  457.         iniwrite("extensions",b,d)
  458.         
  459. &Dir
  460.  Create Director&y...
  461.         a=askline("Create Directory","Enter directory to create",DirGet())
  462.         terminate(a=="","Create Error","Cannot create directory with null name")
  463.         DirMake(strtrim(a))
  464.         SetDisplay("","","")
  465.         drop(a)
  466.  
  467.  &Rename Directory...
  468.         a=DirItemize("")
  469.         terminate(ItemCount(a," ")!=1,"Rename Error","Zero or more than one dir specified")
  470.         b=strtrim(AskLine("Rename Directory","Enter new directory name for %a%",a))
  471.         terminate(a==b || b=="","Rename Error","Illegal name change specified")
  472.         DirRename(a,b)
  473.         SetDisplay("","","")
  474.         OtherUpdate()
  475.         drop(a,b)
  476.  
  477.  &Kill Directory...
  478.         f=DirItemize("")
  479.         terminate(strlen(f)==0,"Delete Directory","No directory specified")
  480.         ;terminate(@no==askyesno("Delete Directory",f),"Delete Directory","Directory not deleted")
  481.         DirRemove(f)
  482.         SetDisplay("","","")
  483.         OtherUpdate()   ; Well if the "other" CmdPost Window points to the
  484.                       ; same directory, it *is* nice
  485.         drop(f)
  486.  
  487.  &Change Directory...
  488.         a=DirGet()
  489.         b=strindex(a,':',1,@fwdscan)
  490.         c=strtrim(askline("Change Directory","Enter directory name",strsub(a,b+1,strlen(a)-b-1)))
  491.         terminate(c=="","Directory Error","Directory with null name does not exist")
  492.         DirChange(c)
  493.         SetDisplay("","","")
  494.         drop(a,b,c)                       
  495.         
  496.  _&Nuke ENTIRE file/dir structure
  497.         files=FileItemize("")
  498.         numfile=ItemCount(files, " ")
  499.         totdir=0
  500.         dir1=DirGet()
  501.         sub1 = DirItemize("")
  502.         numdir1=Itemcount(sub1, " ")
  503.         if (numfile+numdir1)==0 then goto noselect
  504.         Pause("WARNING: Are you Sure :WARNING", "You are about to delete all kinds of stuff%crlf%containing possibly 10 zillion files and subdirs.%crlf%Continue?")
  505.         if AskYesNo("WARNING: Are you REALLY Sure :WARNING","Shall we stop now and not delete anything?")==@YES then goto quitnow
  506.         if AskYesNo("WARNING: Are you Sure :WARNING","CONTINUE???!!!??? %crlf%Are you sure you can find your backups???")==@NO then goto nobackup
  507.   
  508.         if numfile > 0 then FileDelete(files)   ;Whap top level files...
  509.         If numdir1 == 0 Then Goto didit
  510.         level=1
  511.         index1=0
  512.   
  513.   
  514.         :loop
  515.         If index%level% == numdir%level% Then Goto upalevel
  516.         index%level% = index%level% + 1
  517.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  518.         totdir=totdir+1
  519.         Errormode(@off)
  520.         FileDelete("*.*")
  521.         Errormode(@cancel)
  522.         level = level + 1
  523.         dir%level% = DirGet()
  524.         sub%level% = DirItemize("*.*")
  525.         numdir%level% = ItemCount(sub%level%, " ")
  526.         index%level% = 0
  527.         goto loop
  528.   
  529.         :upalevel
  530.         a=strlen(dir%level%)                                 ;7.0S-- bug workaround
  531.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)      ;ditto
  532.         DirChange(dir%level%)
  533.         DirRemove(sub%level%)
  534.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  535.         level=level-1
  536.         if level!=0 then goto loop
  537.         :didit
  538.         SetDisplay("","","")
  539.         OtherUpdate()
  540.         Display(4,"Operation Complete","Files in %totdir% subdirectories deleted")
  541.         goto done
  542.   
  543.         :noselect
  544.         Message("Sorry", "You must highlight target files/directories first.") 
  545.         goto done
  546.         :nobackup
  547.         Message("Well Then","We better not play around with nuclear devices")
  548.         goto done
  549.         :quitnow
  550.         Message("Good Thinking","A wise move. Nothing deleted")
  551.         :done
  552.         drop(files,numfile,dir1,numdir1,totdir)
  553.  
  554.  &Duplicate ENTIRE file/dir structure
  555.         Other0=OtherDir()
  556.         totdir=0
  557.         files=FileItemize("")
  558.         numfile=ItemCount(files, " ")
  559.         dir1=DirGet()
  560.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  561.         sub1 = DirItemize("")
  562.         numdir1=Itemcount(sub1, " ")
  563.         if (numfile+numdir1)==0 then goto noselect
  564.         Other0=AskLine("Replicate structure",strcat(sub1,' ',files,crlf,crlf,"to"),Other0)
  565.         terminate(Other0=="" || Other0==" ","Copy Error","Cannot copy to null file name")
  566.         a=strsub(Other0,strlen(Other0),1)
  567.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  568.   
  569.         if numfile > 0 then FileCopy(files,Other0,@FALSE)   ;Copy top level files...
  570.         If numdir1 == 0 Then Goto didit
  571.         level=1
  572.         index1=0
  573.         ; debug(1)
  574.         :loop
  575.         If index%level% == numdir%level% Then Goto upalevel
  576.         index%level% = index%level% + 1
  577.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  578.         totdir=totdir+1
  579.         a=level-1
  580.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  581.         Errormode(@off)
  582.         DirMake(Other%level%)
  583.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  584.         FileCopy("*.*",Other%level%,@FALSE)
  585.         Errormode(@cancel)
  586.         level = level + 1
  587.         dir%level% = DirGet()
  588.         sub%level% = DirItemize("*.*")
  589.         numdir%level% = ItemCount(sub%level%, " ")
  590.         index%level% = 0
  591.         goto loop
  592.   
  593.         :upalevel
  594.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  595.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  596.         DirChange(dir%level%)
  597.        
  598.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  599.         level=level-1
  600.         if level!=0 then goto loop
  601.         :didit
  602.         SetDisplay("","","")
  603.         OtherUpdate()
  604.         Display(4,"Duplicate Structure Complete","%totdir% directories duplicated")
  605.         goto done
  606.   
  607.         :noselect
  608.         Message("Sorry", "You must highlight source files/directories first.")
  609.         :done
  610.         drop(files,numfile,dir1,numdir1,Other0)
  611.         
  612.  &Move ENTIRE file/dir structure
  613.         Other0=OtherDir()
  614.         totdir=0
  615.         files=FileItemize("")
  616.         numfile=ItemCount(files, " ")
  617.         dir1=DirGet()
  618.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  619.         sub1 = DirItemize("")
  620.         numdir1=Itemcount(sub1, " ")
  621.         if (numfile+numdir1)==0 then goto noselect
  622.         Other0=AskLine("Move structure",strcat(sub1,' ',files,crlf,crlf,"to"),Other0)
  623.         terminate(Other0=="" || Other0==" ","Move Error","Cannot move to null name")
  624.         a=strsub(Other0,strlen(Other0),1)
  625.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  626.   
  627.         if numfile > 0 then FileMove(files,Other0,@FALSE)   ;Copy top level files...
  628.         If numdir1 == 0 Then Goto didit
  629.         level=1
  630.         index1=0
  631.         ; debug(1)
  632.         :loop
  633.         If index%level% == numdir%level% Then Goto upalevel
  634.         index%level% = index%level% + 1
  635.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  636.         totdir=totdir+1
  637.         a=level-1
  638.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  639.         Errormode(@off)
  640.         DirMake(Other%level%)
  641.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  642.         FileMove("*.*",Other%level%,@FALSE)
  643.         Errormode(@cancel)
  644.         level = level + 1
  645.         dir%level% = DirGet()
  646.         sub%level% = DirItemize("*.*")
  647.         numdir%level% = ItemCount(sub%level%, " ")
  648.         index%level% = 0
  649.         goto loop
  650.   
  651.         :upalevel
  652.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  653.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  654.         DirChange(dir%level%)
  655.         DirRemove(sub%level%)
  656.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  657.         level=level-1
  658.         if level!=0 then goto loop
  659.         :didit
  660.         SetDisplay("","","")
  661.         OtherUpdate()
  662.         Display(4,"Move Structure Complete","%totdir% directories moved")
  663.         goto done
  664.   
  665.         :noselect
  666.         Message("Sorry", "You must highlight source files/directories first.")
  667.         :done
  668.         drop(files,numfile,dir1,numdir1,Other0)
  669.         
  670.  &Size of ENTIRE file/dir structure
  671.         tot = FileSize(FileItemize(""))
  672.         totdir=0
  673.         level=1
  674.         dir1=DirGet()
  675.         sub1 = DirItemize("")
  676.         numdir1 = ItemCount(sub1, " ")
  677.         index1 = 0
  678.   
  679.         :loop
  680.         If index%level% == numdir%level% Then Goto upalevel
  681.         index%level% = index%level% + 1
  682.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  683.         totdir=totdir+1
  684.         tot = tot + FileSize(FileItemize("*.*"))
  685.         level = level + 1
  686.         dir%level% = DirGet()
  687.         sub%level% = DirItemize("*.*")
  688.         numdir%level% = ItemCount(sub%level%, " ")
  689.         index%level% = 0
  690.         goto loop
  691.   
  692.         :upalevel
  693.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  694.         level=level-1
  695.         if level!=0 then goto loop
  696.  
  697.         :done
  698.         ; -----------
  699.         ; Termination
  700.         ; -----------
  701.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  702.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  703.         tot = StrTrim(tot)
  704.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  705.         tot = StrTrim(tot)
  706.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  707.         tot = StrTrim(tot)
  708.         Message("%totdir% Subdirecctories included", "Total size %tot% bytes.")
  709.         drop(tot,level,totdir)
  710.  
  711.  
  712.  
  713.  _&Format Diskette...
  714.         ; A wonderful example of variable substitution
  715.         D1="1) 5.25 High Density (1.2M)"
  716.         D2="2) 5.25 Standard (360K)"
  717.         D3="3) 3.5  High Density (1.44M)"
  718.         D4="4) 3.5  Standard (720K)"
  719.         D0="0) None"
  720.         DriveA=inireadpvt(CP,"DriveA","ASK",cpini)
  721.         DriveB=inireadpvt(CP,"DriveB","ASK",cpini)
  722.         if DriveA!="ASK" & DriveB!="ASK" then goto DOFORMAT
  723.  
  724.         DC="%D1%|%D2%|%D3%|%D4%|%D0%"
  725.         Message("Attention","Command Post needs to learn what kind of floppies %crlf% the system has.  Please select accordingly.")
  726.         :ASKA
  727.         a=ItemSelect("Select type of Drive A",DC,"|")
  728.         if a!="" then goto OKDRIVEA
  729.         Message("You MUST select an option for A.","Please retry")
  730.         goto ASKA
  731.         :OKDRIVEA
  732.         DriveA=strsub(a,1,1)
  733.         iniwritepvt(CP,"DriveA",DriveA,cpini)
  734.  
  735.         :ASKB
  736.         a=ItemSelect("Select type of Drive B",DC,"|")
  737.         if a!="" then goto OKDRIVEB
  738.         Message("You MUST select an option for B.","Please retry")
  739.         goto ASKB
  740.         :OKDRIVEB
  741.         DriveB=strsub(a,1,1)
  742.         iniwritepvt(CP,"DriveB",DriveB,cpini)
  743.  
  744.         :DOFORMAT
  745.         A0=""
  746.         A1="1)    A:   5.25 HD (1.2M)|2)    A:   5.25 DD (360K)"
  747.         A2="2)    A:   5.25 DD (360K)"
  748.         A3="3)    A:   3.5 HD (1.44M)|4)    A:   3.5 Std (720K)"
  749.         A4="4)    A:   3.5 Standard (720K)"
  750.         B0=""
  751.         B1="5)    B:   5.25 HD (1.2M)|6)    B:   5.25 DD (360K)"
  752.         B2="6)    B:   5.25 Standard (360K)"
  753.         B3="7)    B:   3.5 HD (1.44M)|8)    B:   3.5 DD (720K)"
  754.         B4="8)    B:   3.5 DD (720K)"
  755.         FF=strcat(A%DriveA%,"|",B%DriveB%)
  756.         drop(A0,A1,A2,A3,A4,B0,B1,B2,B3,B4)
  757.  
  758.         FF=ItemSelect("Choose Format Type Desired",FF,"|")
  759.         terminate(FF=="","Format","No parameters selected")
  760.  
  761.         FF=strsub(FF,1,1)   ; FF will be 1 thru 8 (with luck)
  762.         DR=strsub("AB",(FF>4)+1,1)  ; DR is desired drive
  763.         FF=FF-((FF>4)*4)            ; FF is 1 thru 4
  764.         F11=""
  765.         F12="/4"
  766.         F22=""
  767.         F33=""
  768.         F34="/n:9 /t:80"
  769.         F44=""
  770.         DC=Drive%DR%   ; get drive type
  771.         FC=F%DC%%FF%
  772.         FC="%DR%:  %FC%"
  773.         DC=strsub(D%FF%,4,strlen(d%FF%)-3)
  774.         Pause("Attention",strcat("Preparing to format %DC%",crlf,"diskette in Drive %DR% with command:",crlf,"FORMAT %FC%"))
  775.         comspec=environment("COMSPEC")
  776.         run(comspec,"/c format.com %FC%")
  777.         drop(D0,D1,D2,D3,D4,DC,xxx,DriveA,DriveB)
  778.         drop(FF,DR,F11,F12,F22,F33,F34,F44,DC,FC,comspec)
  779.  
  780.  _Directory &Tree
  781.         run("%CPDIR%cp_tree.exe","")
  782.  
  783.  
  784.  
  785. &View
  786.  &Short
  787.         SetDisplay("SHORT","","")
  788.         MenuChange("ViewShort",@CHECK)
  789.         MenuChange("ViewLong",@UNCHECK)
  790.         iniwritepvt(CP,"ViewShortLong","SHORT",cpini)
  791.  &Long
  792.         SetDisplay("LONG","","")
  793.         MenuChange("ViewShort",@UNCHECK)
  794.         MenuChange("ViewLong",@CHECK)
  795.         iniwritepvt(CP,"ViewShortLong","LONG",cpini)
  796.  _&All
  797.         SetDisplay("","","*.*")
  798.         MenuChange("ViewAll",@CHECK)
  799.         MenuChange("ViewPartial",@UNCHECK)
  800.         MenuChange("ViewPrograms",@UNCHECK)
  801.         iniwritepvt(CP,"ViewWhat","ALL",cpini)
  802.  &Partial...
  803.         a=inireadpvt(CP,"Partial","*.*",cpini)
  804.         a=AskLine("View Partial","Enter types of files desired",a)
  805.         iniwritepvt(CP,"Partial",a,cpini)
  806.         SetDisplay("","",a)
  807.         MenuChange("ViewAll",@UNCHECK)
  808.         MenuChange("ViewPartial",@CHECK)
  809.         MenuChange("ViewPrograms",@UNCHECK)
  810.         iniwritepvt(CP,"ViewWhat","PARTIAL",cpini)
  811.  P&rograms
  812.         SetDisplay("","","*.EXE *.COM *.BAT *.PIF")
  813.         MenuChange("ViewAll",@UNCHECK)
  814.         MenuChange("ViewPartial",@UNCHECK)
  815.         MenuChange("ViewPrograms",@CHECK)
  816.         iniwritepvt(CP,"ViewWhat","PROGRAMS",cpini)
  817.  _By &Name
  818.         SetDisplay("","NAME","")
  819.         MenuChange("ViewByName",@CHECK)
  820.         MenuChange("ViewByDate",@UNCHECK)
  821.         MenuChange("ViewBySize",@UNCHECK)
  822.         MenuChange("ViewByKind",@UNCHECK)
  823.         MenuChange("ViewUnsorted",@UNCHECK)
  824.         iniwritepvt(CP,"ViewBy","NAME",cpini)
  825.  By &Date
  826.         SetDisplay("","DATE","")
  827.         MenuChange("ViewByName",@UNCHECK)
  828.         MenuChange("ViewByDate",@CHECK)
  829.         MenuChange("ViewBySize",@UNCHECK)
  830.         MenuChange("ViewByKind",@UNCHECK)
  831.         MenuChange("ViewUnsorted",@UNCHECK)
  832.         iniwritepvt(CP,"ViewBy","DATE",cpini)
  833.  By Si&ze
  834.         SetDisplay("","SIZE","")
  835.         MenuChange("ViewByName",@UNCHECK)
  836.         MenuChange("ViewByDate",@UNCHECK)
  837.         MenuChange("ViewBySize",@CHECK)
  838.         MenuChange("ViewByKind",@UNCHECK)
  839.         MenuChange("ViewUnsorted",@UNCHECK)
  840.         iniwritepvt(CP,"ViewBy","SIZE",cpini)
  841.  By &Kind       
  842.         SetDisplay("","KIND","")
  843.         MenuChange("ViewByName",@UNCHECK)
  844.         MenuChange("ViewByDate",@UNCHECK)
  845.         MenuChange("ViewBySize",@UNCHECK)
  846.         MenuChange("ViewByKind",@CHECK)
  847.         MenuChange("ViewUnsorted",@UNCHECK)
  848.         iniwritepvt(CP,"ViewBy","KIND",cpini)
  849.  &Unsorted
  850.         SetDisplay("","UNSORTED","")
  851.         MenuChange("ViewByName",@UNCHECK)
  852.         MenuChange("ViewByDate",@UNCHECK)
  853.         MenuChange("ViewBySize",@UNCHECK)
  854.         MenuChange("ViewByKind",@UNCHECK)
  855.         MenuChange("ViewUnsorted",@CHECK)
  856.         iniwritepvt(CP,"ViewBy","UNSORTED",cpini)
  857.  
  858.  |&1 Stack
  859.         winarrange(1)
  860.  &2 Arrange
  861.         winarrange(2)
  862.  &3 Arrange in Rows
  863.         winarrange(3)
  864.  &4 Arrange in Columns
  865.         winarrange(4)
  866.  _&5 (w/o CP) Stack
  867.         winiconize("")
  868.         winarrange(1)
  869.  &6 (w/o CP) Arrange
  870.         winiconize("")
  871.         winarrange(2)
  872.  &7 (w/o CP) Arrange in Rows
  873.         winiconize("")
  874.         winarrange(3)
  875.  &8 (w/o CP) Arrange in Cols
  876.         winiconize("")
  877.         winarrange(4)
  878.         
  879.  _Change &Wallpaper
  880.            DirChange(FilePath(FileLocate("WIN.INI")))
  881.            a=FileItemize("*.BMP")
  882.            a=strcat("-None- ",a)
  883.            a=ItemSelect("Select New Wallpaper",a," ")
  884.            terminate(a=="","Wallpaper","No wallpaper selected")
  885.            if a=="-None-" then Wallpaper("",0)
  886.            if a=="-None-" then exit
  887.            tile=@FALSE
  888.            if FileSize(a)<40000 then tile=@TRUE  
  889.            ;if bmp size less than 40K, assume tile, else center
  890.            Wallpaper(a,tile)
  891.            drop(a,tile)
  892.  
  893.  
  894. &Main
  895.  &Command Post (More Windows)
  896.        a=IntControl(2,0,0,0,0)
  897.        if a==1 then goto runner
  898.        if a==4 then goto posit
  899.        a=Display(3,"%a% CmdPost Windows exist","Hit any key to just position%crlf%existing windows")
  900.        if a==1 then goto posit
  901.        :runner
  902.           DirChange(CPDIR)
  903.           run("cmdpost.exe","")
  904.           exit
  905.        :posit
  906.           IntControl(6,0,0,0,0)   ;Repositions all open cp windows
  907.        
  908.  Control &Panel
  909.         errormode(@off)
  910.         terminate(winactivate("Control Panel"),"","")
  911.         errormode(@cancel)
  912.         run("control.exe","")
  913.  
  914.  C&lipboard
  915.         errormode(@off)
  916.         terminate(winactivate("Clipboard"),"","") ;Already Running
  917.         errormode(@cancel)
  918.         run("Clipbrd.exe","")
  919.  
  920.  &DOS Prompt
  921.         run(Environment("COMSPEC"),"")
  922.  
  923.  _Get &Help Cardfile
  924.            run("cardfile.exe","%CPDIR%cp_help.crd")
  925.  Get &Question 'n' Answer Cardfile
  926.            run("cardfile.exe","%CPDIR%cp_quest.crd")
  927.  
  928.  Preferences
  929.   Show System/Hidden Files
  930.         a=strupper(inireadpvt(CP,"SysHide","0",cpini))
  931.         c="YES"
  932.         if a==0 then c="NO"
  933.         b=AskYesNo("System/Hidden Files","Show System and Hidden files?%crlf%Current answer=%c%%crlf%Enter desired answer")
  934.         if a!=b then iniwritepvt(CP,"SysHide",b,cpini)
  935.         IntControl(5,b,0,0,0)                 ;Controls system/hidden show flag
  936.         SetDisplay("","","")
  937.  
  938.   Set Blanker/Clock Options
  939.         a=inireadpvt(CP,"BlankTime",5,cpini)
  940.         b1="Enter screen blanker delay time"
  941.         b2="or 0 to disable blanker"
  942.         b3="or negative time to disable clock"
  943.         b4="or 9999 to eliminate it altogether"
  944.         b1=strcat(b1,crlf,b2,crlf,b3,crlf,b4)
  945.         a=AskLine("Screen Blanker",b1,a)
  946.         iniwritepvt(CP,"BlankTime",a,cpini)
  947.         ErrorMode(@OFF)
  948.         WinClose("CmdPost Clock")
  949.         ErrorMode(@CANCEL)
  950.         if a!=9999 then run("%CPDIR%CP_BLNK.EXE",a)
  951.  
  952.   Save CmdPost Window Positions
  953.         c=IntControl(2,0,0,0,0)     ;This guy returns # of CP Windows open
  954.         b1="Do you wish to save the current CmdPost"
  955.         b2="window positions for future startups?"
  956.         b3="Note: You can save positions of combinations"
  957.         b4="of 1, 2, 3, and 4 window positions."
  958.         b5="Now saving window positions for %c% windows"
  959.         b1=strcat(b1,crlf,b2,crlf,crlf,b3,crlf,b4,crlf,b5)
  960.         drop(b2,b3,b4,b5)
  961.         a=AskYesNo("CmdPost Window Positions",b1)
  962.         if a==@YES then IntControl(3,0,0,0,0) ;This causes all cp's to write
  963.         exit                                  ;their position information
  964.  
  965.   Printer Options
  966.         iniwritepvt(CP,"TextPrinter","ASK",cpini)
  967.         MenuChange("FilePrint",@ENABLE)
  968.         b1="CmdPost's saved information reset."
  969.         b2="You will be prompted to re-enter the"
  970.         b3="necessary information when it is required."
  971.         b1=strcat(b1,crlf,b2,crlf,b3)
  972.         Message("Information Reset",b1)
  973.  
  974.   Floppy Options
  975.         iniwritepvt(CP,"DriveA","ASK",cpini)
  976.         iniwritepvt(CP,"DriveB","ASK",cpini)
  977.         b1="CmdPost's saved information reset."
  978.         b2="You will be prompted to re-enter the"
  979.         b3="necessary information when it is required."
  980.         b1=strcat(b1,crlf,b2,crlf,b3)
  981.         Message("Information Reset",b1)
  982.  
  983.  
  984.   Auto Run= and Load= Options
  985.         a=strupper(inireadpvt(CP,"AutoStart","YES",cpini))
  986.         b=AskYesNo("Auto Startup from WIN.INI","Auto start from WIN.INI RUN= and LOAD= lines?%crlf%Current answer=%a%%crlf%Enter desired answer")
  987.         if b==@NO then b="NO"
  988.         if b==@YES then b="YES"
  989.         if a!=b then iniwritepvt(CP,"AutoStart",b,cpini)
  990.         
  991.   CmdPost Window Titles
  992.    Window 1
  993.         c=strcat("Command Post ",version()," #")
  994.         a=1
  995.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  996.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  997.         iniwritepvt(CP,"Title%a%",b,cpini)
  998.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  999.    Window 2
  1000.         c=strcat("Command Post ",version()," #")
  1001.         a=2
  1002.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1003.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1004.         iniwritepvt(CP,"Title%a%",b,cpini)
  1005.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1006.    Window 3
  1007.         c=strcat("Command Post ",version()," #")
  1008.         a=3
  1009.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1010.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1011.         iniwritepvt(CP,"Title%a%",b,cpini)
  1012.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1013.    Window 4
  1014.         c=strcat("Command Post ",version()," #")
  1015.         a=4
  1016.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1017.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1018.         iniwritepvt(CP,"Title%a%",b,cpini)
  1019.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1020.  
  1021.   View Startup Options
  1022.         a=strupper(inireadpvt(CP,"ViewSetup","NO",cpini))
  1023.         b=AskYesNo("Remember View options","Should View menu options be remembered?%crlf%Current answer=%a%%crlf%Enter desired answer")
  1024.         if b==@NO then b="NO"
  1025.         if b==@YES then b="YES"
  1026.         if a!=b then iniwritepvt(CP,"ViewSetup",b,cpini)
  1027.  
  1028.   Editor Options
  1029.         Editor=strtrim(strupper(AskLine("Editor Selection","Enter desired editor",Editor)))
  1030.         iniwritepvt(CP,"Editor",Editor,cpini)
  1031.           
  1032.   File Refresh
  1033.    On
  1034.            IniWritePvt(CP,"AutoUpdate",1,cpini)
  1035.            MenuChange("MainPreferencesFileRefreshOn",@CHECK)
  1036.            MenuChange("MainPreferencesFileRefreshOff",@UNCHECK)
  1037.    Off
  1038.            IniWritePvt(CP,"AutoUpdate",0,cpini)
  1039.            MenuChange("MainPreferencesFileRefreshOn",@UNCHECK)
  1040.            MenuChange("MainPreferencesFileRefreshOff",@CHECK)
  1041.            
  1042.   Default startup program
  1043.            a=IniRead("Extensions","*","Browser.exe")         
  1044.            a=AskLine("Default startup program","Enter program to run for file when%crlf%file extension is not defined",a)
  1045.            iniwrite("Extensions","*",a)
  1046.    
  1047.           
  1048.  _Run "Managers"           
  1049.  
  1050.   P&rogram Manager
  1051.         errormode(@off)
  1052.         terminate(winactivate("Program Manager"),"","") ;Already Running
  1053.         errormode(@cancel)
  1054.         run("Progman.exe","")
  1055.  
  1056.   &File Manager
  1057.         errormode(@off)
  1058.         terminate(winactivate("File Manager"),"","") ;Already Running
  1059.         errormode(@cancel)
  1060.         run("winfile.exe","")
  1061.  
  1062.   Print &Manager
  1063.         run("printman.exe","")   ; takes care of itself
  1064.  
  1065.  
  1066.  _Edit Configurations
  1067.   &Edit CmdPost menus
  1068.    CMDPOST.CPM
  1069.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1070.            a="CMDPOST.CPM"
  1071.  
  1072.            ;it it already running???  Find it...
  1073.            b=WinItemize()
  1074.            bup=StrUpper(b)
  1075.            c=ItemCount(bup,tab)
  1076.            d=0
  1077.            :woop
  1078.            if c==d then goto doit
  1079.            d=d+1
  1080.            e=itemextract(d,bup,tab)
  1081.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1082.            e=itemextract(d,b,tab)
  1083.            WinActivate(e)
  1084.            goto goombye
  1085.            
  1086.            :doit
  1087.            bup=strcat( FileRoot(a),".BAK")
  1088.            FileCopy(a,bup,@FALSE);
  1089.            run(Editor,a)
  1090.            :goombye
  1091.            drop(a,b,c,d,e,bup)
  1092.    CMDUSER.CPM
  1093.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1094.            a="CMDUSER.CPM"
  1095.  
  1096.            ;it it already running???  Find it...
  1097.            b=WinItemize()
  1098.            bup=StrUpper(b)
  1099.            c=ItemCount(bup,tab)
  1100.            d=0
  1101.            :woop
  1102.            if c==d then goto doit
  1103.            d=d+1
  1104.            e=itemextract(d,bup,tab)
  1105.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1106.            e=itemextract(d,b,tab)
  1107.            WinActivate(e)
  1108.            goto goombye
  1109.            
  1110.            :doit
  1111.            bup=strcat( FileRoot(a),".BAK")
  1112.            FileCopy(a,bup,@FALSE);
  1113.            run(Editor,a)
  1114.            :goombye
  1115.            drop(a,b,c,d,e,bup)
  1116.  
  1117.   Edit &INI files
  1118.            DirChange(FilePath(FileLocate("WIN.INI")))
  1119.            a=FileItemize("*.INI")
  1120.            a=ItemSelect("Select INI file to edit",a," ")
  1121.            terminate(a=="","Edit","No file selected")
  1122.  
  1123.            ;it it already running???  Find it...
  1124.            b=WinItemize()
  1125.            bup=StrUpper(b)
  1126.            c=ItemCount(bup,tab)
  1127.            d=0
  1128.            :woop
  1129.            if c==d then goto doit
  1130.            d=d+1
  1131.            e=itemextract(d,bup,tab)
  1132.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1133.            e=itemextract(d,b,tab)
  1134.            WinActivate(e)
  1135.            goto goombye
  1136.            
  1137.            :doit
  1138.            bup=strcat( FileRoot(a),".BAK")
  1139.            FileCopy(a,bup,@FALSE);
  1140.            run(Editor,a)
  1141.            :goombye
  1142.            drop(a,b,c,d,e,bup)
  1143.  
  1144.   Run System Confi&guration Editor
  1145.            run("sysedit.exe","")  ;takes care of itself
  1146.   Run Windows Setup
  1147.         a=FilePath(Filelocate("system.ini"))
  1148.         DirChange(a)
  1149.         run("setup.exe","")
  1150.         drop(a)
  1151.   Restart Windows
  1152.    NO! Wait
  1153.         Display(4,"OK","I'll wait")
  1154.    Really! Doit!
  1155.         IntControl(66,0,0,0,0)
  1156.         
  1157.            
  1158.  
  1159.   _PIF Edi&t...
  1160.         a=strupper(FileExtension(CurrentFile()))
  1161.         if a!="PIF" then goto PIF2
  1162.         run("pifedit.exe",CurrentFile())
  1163.         exit
  1164.         :PIF2
  1165.         if IsKeyDown(@SHIFT)==@YES then DirChange(FilePath(FileLocate("_default.pif")))
  1166.         a=FileItemize("*.PIF")
  1167.         if a==""  then DirChange(FilePath(FileLocate("_default.pif")))
  1168.         if a=="" then a=FileItemize("*.PIF")
  1169.         a=ItemSelect("Choose a PIF File to edit",a," ")
  1170.         run("pifedit.exe",a)
  1171.         exit
  1172.  
  1173.  _&System Information
  1174.         run("%CPDIR%cp_info.exe","")
  1175.  
  1176.  
  1177.  
  1178.     
  1179.